package com.example.qinghe.service.sale;


import com.example.qinghe.dao.sale.CustomerqhMapper;
import com.example.qinghe.entity.Page;
import com.example.qinghe.entity.sale.Customerqh;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomerqhService {

    @Autowired
    private CustomerqhMapper dao;

    public List<Customerqh> selectCustomerList(Page page, @Param("pagestart") int pagestart, @Param("limit") int limit, @Param("company")String company, @Param("name")String name, @Param("phone")String phone, @Param("field")String field){
        return dao.selectCustomerList((page.getPage() - 1) * page.getLimit(), page.getLimit(),company,name,phone,field);
    }


    public int countTotall( @Param("company")String company, @Param("name")String name, @Param("phone")String phone, @Param("field")String field)
    {
        return dao.countTotall(company,name,phone,field);
    }

    public Customerqh selectCustomerById(Long id){
        return dao.selectCustomerById(id);
    }

    public List<Customerqh> selectCustomerByStaffId(Long id,@Param("company")String company,@Param("name")String name,@Param("phone")String phone,@Param("field")String field){
        return dao.selectCustomerByStaffId(id,company,name,phone,field);
    }

}
